/**
 * Created by Administrator on 14-1-7.
 */
(function($) {
    var arkflow = $.arkflow;

    // 创建编辑框
    arkflow.editors.InputEditor = Base.extend({
        constructor : function() {
        },
        init : function(props, k, div, src, r) {
            this._props = props;
            this._k = k;
            this._div = div;
            this._src = src;
            this._r = r;
            var me = this;
            if (props[this._k].name == "name" && arkflow.config.flowName != "") {
                props[this._k].value = arkflow.config.flowName;
                $('<input style="width:100%;" readonly="readonly" />').val(props[this._k].value).change(function() {
                    props[me._k].value = $(this).val();
                }).appendTo('#' + this._div);
                $('#' + this._div).data('editor', this);
            } else {
                $('<input style="width:100%;"/>').val(props[this._k].value).change(function() {
                    props[me._k].value = $(this).val();
                }).appendTo('#' + this._div);
                $('#' + this._div).data('editor', this);
            }
        },
        destroy : function() {
            var me = this;
            $('#' + this._div + ' input').each(function() {
                me._props[me._k].value = $(this).val();
            });
        }
    });

})(jQuery);
